package com.iss.yunpan.service.impl;


import com.iss.yunpan.dao.RecycleDao;
import com.iss.yunpan.entity.FileContent;
import com.iss.yunpan.entity.RecycleContent;
import com.iss.yunpan.service.RecycleService;
import com.obs.services.ObsClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.util.List;

@Service
public class RecycleServiceImpl implements RecycleService {
    @Autowired
    private HttpSession session;

    private String endPoint="obs.cn-north-4.myhuaweicloud.com";
    private String ak="OP9RXAGXSFPPRSEZVD27";
    private String sk="58KfxQOSUT5YMCXRCSXEEStrFdzTGTKPnFwSqnns";
    private String bucketName = "sanzu";

    @Autowired//依赖注入
    private RecycleDao dao;

    @Override
    public List<FileContent> allDeleteFile(String fileName){
        ObsClient obsClient = new ObsClient(ak, sk, endPoint);
        obsClient.deleteObject(bucketName, fileName);
        return dao.allDeleteFile(fileName);
    }
}